import {AcGameObject} from "@/assets/scripts/AcGameObject";

//放置障碍物类
export class Wall extends AcGameObject {
    constructor(r, c, gamemap) {
        super();

        this.r = r;
        this.c = c;
        this.gamemap = gamemap;
        this.color = "#B37226";
    }

    update() {              //方法重写
        this.render();
    }

    render() {              //确定墙的大小
        const L = this.gamemap.L;
        const ctx = this.gamemap.ctx;

        //设置画布的演示和位置
        ctx.fillStyle = this.color;
        //(x,y,w,h)
        ctx.fillRect(this.c * L, this.r * L, L, L);
    }
}